@echo off
set count=1
set pid=%1

:loop
    echo start capture %count% picture
    hdc shell hilog -r
    hdc shell uinput -K -d 19 -u 19
    set curTime=%date:~5,2%-%date:~8,2%_%time:~0,2%.%time:~3,2%.%time:~6,2%.%time:~9,2%
    set curTime=%curTime: =%
    set logfile=zp37a_autoPicture_hilog_%curTime%.log
    hdc shell hilog -x > %logfile%
    timeout /nobreak /t 1
    set /a count+=1
    for /f "tokens=*" %%i in ('hdc shell ps -p %pid%') do (
	    @set process=%%i
    )
    echo %process%
    set subString=com.example.cam

    echo %process%|findstr %subString% >nul
    if %errorlevel% equ 0 (
        echo "camera not killed "
        goto loop
    ) else (
        echo "camera has killed"
    )
